package cn.hls.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import cn.hls.dao.GoodsDao;
import cn.hls.entity.Goods;
import cn.hls.entity.vo.PageInfo;
import cn.hls.service.GoodsService;

 
/**
  *@fileName: GoodsServiceBean.java
  *@package: cn.hls.service.impl
　*@Description:　货物业务逻辑实现类
　*@author: yinghui.zhang
　*@email: uuhui@163.com
  *@date: 2016年6月9日
 *
 */
@Component("goodsService")
public class GoodsServiceBean extends BaseServiceBean<Goods> implements
		GoodsService {
	@Resource(name = "goodsDao")
	private GoodsDao dao;

	@Override
	public PageInfo<Goods> loadGoodsInfo(Goods entity,
			PageInfo<Goods> page) throws Exception {
		return dao.loadGoodsInfo(entity, page);
	}
	
	@Override
	public List<Goods> loadGoodsList(Goods entity)throws Exception{
		return dao.loadGoodsList(entity);
	}

	@Override
	public boolean exists(Goods entity) throws Exception {
		return dao.exists(entity);
	}
	
	@Override
	public void delete(Object entityId) throws Exception {
		dao.delete(entityId);
	}
	
	@Override
	public boolean update(Goods entity) throws Exception {
		Goods tempGoods=dao.find(entity.getId());
		Date createTime=tempGoods.getCreateTime();
		BeanUtils.copyProperties(entity, tempGoods);
		tempGoods.setCreateTime(createTime);
		tempGoods.setUpdateTime(new Date());
		return super.update(tempGoods);
	}

}
